<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>旅行家 - 发现世界的精彩</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="css/index.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- 导航栏 -->
<nav class="navbar navbar-expand-lg navbar-dark sticky-top">
    <div class="container">
        <a class="navbar-brand" href="#">
            <i class="fas fa-compass me-2"></i>旅行家
        </a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav me-auto">
                <li class="nav-item">
                    <a class="nav-link active" href="#">首页</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="Objective.html">目的地</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">攻略</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">论坛</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/lv-user/aboutus.html">关于我们</a>
                </li>
            </ul>
            <div class="d-flex" id="userNav">
                <a href="/lv-user/reg.html" class="btn btn-light">登录/注册</a>
            </div>
        </div>
    </div>
</nav>

<!-- 轮播图 -->
<div id="mainCarousel" class="carousel slide" data-bs-ride="carousel">
    <div class="carousel-indicators">
        <button type="button" data-bs-target="#mainCarousel" data-bs-slide-to="0" class="active"></button>
        <button type="button" data-bs-target="#mainCarousel" data-bs-slide-to="1"></button>
        <button type="button" data-bs-target="#mainCarousel" data-bs-slide-to="2"></button>
    </div>
    <div class="carousel-inner">
        <div class="carousel-item active" style="background-image: url('https://images.unsplash.com/photo-1506929562872-bb421503ef21?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80')">
            <div class="carousel-caption d-none d-md-block">
                <h5>探索未知的风景</h5>
                <p>发现世界上最美的自然奇观</p>
            </div>
        </div>
        <div class="carousel-item" style="background-image: url('https://images.unsplash.com/photo-1464037866556-6812c9d1c72e?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80')">
            <div class="carousel-caption d-none d-md-block">
                <h5>记录你的旅行故事</h5>
                <p>与百万旅行家分享你的经历</p>
            </div>
        </div>
        <div class="carousel-item" style="background-image: url('https://images.unsplash.com/photo-1508672019048-805c876b67e2?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80')">
            <div class="carousel-caption d-none d-md-block">
                <h5>寻找旅行伙伴</h5>
                <p>结识志同道合的旅行爱好者</p>
            </div>
        </div>
    </div>
    <button class="carousel-control-prev" type="button" data-bs-target="#mainCarousel" data-bs-slide="prev">
        <span class="carousel-control-prev-icon"></span>
    </button>
    <button class="carousel-control-next" type="button" data-bs-target="#mainCarousel" data-bs-slide="next">
        <span class="carousel-control-next-icon"></span>
    </button>
</div>

<!-- 主要内容 -->
<div class="container my-5">
    <!-- 热门帖子 -->
    <section class="mb-5">
        <div class="d-flex justify-content-between align-items-center mb-4">
            <h2><i class="fas fa-fire text-danger me-2"></i>热门帖子</h2>
            <a href="#" class="btn btn-outline-primary">查看更多</a>
        </div>
        <div class="row">
            <div class="col-md-4">
                <div class="card">
                    <img src="https://images.unsplash.com/photo-1520250497591-112f2f40a3f4?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" class="card-img-top" alt="...">
                    <div class="card-body">
                        <div class="d-flex justify-content-between mb-2">
                            <span class="badge bg-primary">精华</span>
                            <small class="text-muted">3天前</small>
                        </div>
                        <h5 class="card-title">独自骑行川藏线的30天</h5>
                        <p class="card-text">从成都到拉萨，2142公里的心灵之旅，分享我的路线规划和实用建议...</p>
                        <div class="d-flex justify-content-between align-items-center">
                            <a href="#" class="btn btn-sm btn-outline-secondary">阅读更多</a>
                            <small class="text-muted">
                                <i class="fas fa-eye me-1"></i> 1.2k
                                <i class="fas fa-comment ms-3 me-1"></i> 56
                            </small>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card">
                    <img src="https://images.unsplash.com/photo-1493246507139-91e8fad9978e?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" class="card-img-top" alt="...">
                    <div class="card-body">
                        <div class="d-flex justify-content-between mb-2">
                            <span class="badge bg-success">攻略</span>
                            <small class="text-muted">1周前</small>
                        </div>
                        <h5 class="card-title">东南亚背包客省钱全指南</h5>
                        <p class="card-text">用3000元玩转泰国、越南、柬埔寨一个月，青旅、美食、交通全攻略...</p>
                        <div class="d-flex justify-content-between align-items-center">
                            <a href="readmore.html?nid=1001" class="btn btn-sm btn-outline-secondary">阅读更多</a>
                            <small class="text-muted">
                                <i class="fas fa-eye me-1"></i> 2.3k
                                <i class="fas fa-comment ms-3 me-1"></i> 124
                            </small>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card">
                    <img src="https://images.unsplash.com/photo-1501594907352-04cda38ebc29?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" class="card-img-top" alt="...">
                    <div class="card-body">
                        <div class="d-flex justify-content-between mb-2">
                            <span class="badge bg-warning text-dark">问答</span>
                            <small class="text-muted">2天前</small>
                        </div>
                        <h5 class="card-title">冬季北海道自驾游注意事项</h5>
                        <p class="card-text">12月计划去北海道自驾，求问雪地驾驶经验和必去景点推荐...</p>
                        <div class="d-flex justify-content-between align-items-center">
                            <a href="readmore.html?nid=1002" class="btn btn-sm btn-outline-secondary">阅读更多</a>
                            <small class="text-muted">
                                <i class="fas fa-eye me-1"></i> 856
                                <i class="fas fa-comment ms-3 me-1"></i> 42
                            </small>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- 推荐目的地 -->
    <section class="mb-5">
        <h2 class="mb-4"><i class="fas fa-map-marked-alt text-info me-2"></i>推荐目的地</h2>
        <div class="row">
            <div class="col-md-3">
                <div class="destination-card">
                    <img src="https://images.unsplash.com/photo-1538970272646-f61fabb3be33?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" class="destination-img" alt="日本">
                    <div class="destination-overlay">
                        <h5>日本·京都</h5>
                        <p>1256篇游记</p>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="destination-card">
                    <img src="https://images.unsplash.com/photo-1518391846015-55a9cc003b25?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" class="destination-img" alt="新西兰">
                    <div class="destination-overlay">
                        <h5>新西兰·皇后镇</h5>
                        <p>892篇游记</p>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="destination-card">
                    <img src="https://images.unsplash.com/photo-1523482580672-f109ba8cb9be?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" class="destination-img" alt="冰岛">
                    <div class="destination-overlay">
                        <h5>冰岛·雷克雅未克</h5>
                        <p>673篇游记</p>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="destination-card">
                    <img src="https://images.unsplash.com/photo-1520250497591-112f2f40a3f4?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" class="destination-img" alt="西藏">
                    <div class="destination-overlay">
                        <h5>中国·西藏</h5>
                        <p>2453篇游记</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- 最新活动 -->
    <section class="mb-5">
        <h2 class="mb-4"><i class="fas fa-calendar-alt text-warning me-2"></i>最新活动</h2>
        <div class="row">
            <div class="col-md-6">
                <div class="card mb-3">
                    <div class="row g-0">
                        <div class="col-md-4">
                            <img src="https://images.unsplash.com/photo-1527631746610-bca00a040d60?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" class="img-fluid rounded-start h-100" style="object-fit: cover;" alt="...">
                        </div>
                        <div class="col-md-8">
                            <div class="card-body">
                                <h5 class="card-title">摄影大赛：最美秋色</h5>
                                <p class="card-text">分享你拍摄的秋季风景照片，赢取专业摄影器材</p>
                                <p class="card-text"><small class="text-muted">截止日期: 2023-11-30</small></p>
                                <a href="#" class="btn btn-sm btn-primary">立即参与</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="card mb-3">
                    <div class="row g-0">
                        <div class="col-md-4">
                            <img src="https://images.unsplash.com/photo-1501555088652-021faa106b9b?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80" class="img-fluid rounded-start h-100" style="object-fit: cover;" alt="...">
                        </div>
                        <div class="col-md-8">
                            <div class="card-body">
                                <h5 class="card-title">旅行故事分享会</h5>
                                <p class="card-text">线下聚会，聆听资深旅行家的精彩故事</p>
                                <p class="card-text"><small class="text-muted">2023-10-15 · 北京</small></p>
                                <a href="#" class="btn btn-sm btn-primary">报名参加</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>

<!-- 页脚 -->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-md-4 mb-4">
                <h5>关于旅行家</h5>
                <p>我们是一个热爱旅行的团队，致力于为旅行爱好者提供最好的交流平台和实用信息。</p>
            </div>
            <div class="col-md-2 mb-4">
                <h5>快速链接</h5>
                <ul class="list-unstyled">
                    <li><a href="#" class="text-white">首页</a></li>
                    <li><a href="#" class="text-white">目的地</a></li>
                    <li><a href="#" class="text-white">旅行攻略</a></li>
                    <li><a href="#" class="text-white">论坛</a></li>
                </ul>
            </div>
            <div class="col-md-3 mb-4">
                <h5>联系我们</h5>
                <ul class="list-unstyled">
                    <li><i class="fas fa-envelope me-2"></i> contact@lvtravel.com</li>
                    <li><i class="fas fa-phone me-2"></i> 400-123-4567</li>
                    <li><i class="fas fa-map-marker-alt me-2"></i> 北京市朝阳区旅行大厦</li>
                </ul>
            </div>
            <div class="col-md-3 mb-4">
                <h5>订阅电子报</h5>
                <p>获取最新旅行资讯和优惠活动</p>
                <div class="input-group mb-3">
                    <input type="email" class="form-control" placeholder="您的邮箱">
                    <button class="btn btn-primary" type="button">订阅</button>
                </div>
            </div>
        </div>
        <hr class="my-4 bg-light">
        <div class="text-center">
            <p class="mb-0">© 2025 旅行家 版权所有</p>
        </div>
    </div>
</footer>

<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<!-- 用户状态处理 -->
<script>
    document.addEventListener('DOMContentLoaded', function() {
        const userInfo = JSON.parse(localStorage.getItem('userInfo'));
        const userNav = document.getElementById('userNav');

        if (userInfo) {
            // 用户已登录，显示用户头像和下拉菜单
            userNav.innerHTML = `
                <div class="dropdown">
                    <a href="#" class="d-flex align-items-center text-white text-decoration-none dropdown-toggle" id="dropdownUser" data-bs-toggle="dropdown" aria-expanded="false">
                        <img src="img/${userInfo.head}.png" alt="用户头像" width="32" height="32" class="rounded-circle me-2">
                        <span>${userInfo.uname}</span>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownUser">
                        <li><a class="dropdown-item" href="profile.html">个人中心</a></li>
                        <li><a class="dropdown-item" href="#">我的收藏</a></li>
                        <li><a class="dropdown-item" href="#">我的游记</a></li>
                        <li><hr class="dropdown-divider"></li>
                        <li><a class="dropdown-item" href="#" id="logoutBtn">退出登录</a></li>
                    </ul>
                </div>
            `;

            // 添加注销事件
            document.getElementById('logoutBtn').addEventListener('click', function(e) {
                e.preventDefault();
                localStorage.removeItem('userInfo');
                window.location.href = 'index1.html'; // 刷新页面
            });
        } else {
            // 用户未登录，保持原来的登录/注册按钮
            userNav.innerHTML = '<a href="/lv-user/reg.html" class="btn btn-light">登录/注册</a>';
        }
    });
</script>
</body>
</html>